#pragma once

#include <stdint.h>
#include <stdbool.h>

struct hal_uart
{
    volatile uint8_t trhr;
    volatile uint8_t ier;
    volatile uint8_t fcr;
    volatile uint8_t lcr;
    volatile uint8_t mcr;
    volatile uint8_t lsr;
};

void hal_uart_reset(struct hal_uart *uart);
int hal_uart_putc(struct hal_uart *uart, uint8_t c);
int hal_uart_getc(struct hal_uart *uart, uint8_t *c);
void hal_uart_rxie_set(struct hal_uart *uart, int enable);
void hal_uart_txie_complete_setup(struct hal_uart *uart, int enable);
int hal_uart_tx_available(struct hal_uart *uart);
bool hal_uart_status_tx_complete(struct hal_uart *uart);
